<?
/*

	Disqus recent comments
	Sidebar plugin
	
*/	

	// Tell the system we are a sidebar plugin
	function disquscomments_pluginType() { 
		return "sidebar";	
	}
	
	// Tell the system our full name
	function disquscomments_pluginName() {
		return "Recent comments";
	}
	
	// The description of our services as a plugin
	function disquscomments_pluginDescription() {
		return "Display the recent comments from the Disqus system";
	}

	// can we edit settings?
	function disquscomments_hasEdit() {
		return true;
	}

	// This is displayed to the user , and should contain all options for setting up the plugin
	//	 presetoptions is an array
	//		either null or contains all the options incase of editing this plugin
	function disquscomments_optionForm($presetoptions) {
		global $disqusname;
		$form="";

		$form.="Title for widget<br/>";
		$form.="<input type='text' name='title'";
		if ($presetoptions) $form.="value='".$values[2]."'";
		$form.="/><br/>";
		
		if (!$disqusname) print "Make sure to set your disqus blog name in the Puddle settings!";
		
		return $form;
	}


	// Assemble the plugin return string based on the $_POST array values
	//	use | between each setting..  result will be htmlified
	function disquscomments_addPlugin() {
		$formline="";
		$formline.=$_POST['content'];
		return $formline;
	}
	
	
	// Print the result !
	function disquscomments_draw($line) {
		global $disqusname;
		
		print "<div class='sidebarcontent'>";

		if ($disqusname) { 
?>
			<div id="dsq-recentcomments" class="dsq-widget"><script type="text/javascript" src="http://disqus.com/forums/<?=$disqusname;?>/recent_comments_widget.js?num_items=5&avatar_size=32"></script></div>
<?
		}

		print "</div>";
	}

?>